package com.edais.dao;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.edais.domain.InterfaceWhite;
import com.edais.domain.User;
import com.edais.persistence.UserCheckMapper;

@Repository

public class UserCheckDao {
	
	@Autowired
	private UserCheckMapper userCheckMapper;

	/**
	 * 用户token
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	public int updateUserByUserId(Map<String,Object> param)throws Exception{
		return userCheckMapper.updateUserByUserId(param);
	}
	
	/**
	 * 查询用户token
	 * @param userId
	 * @return
	 * @throws Exception
	 */
	public String queryUserByUserId(Long userId) throws Exception{
		return userCheckMapper.queryUserByUserId(userId);
	}

	/**
	 * 根据token查询用户
	 * @param token
	 * @return
	 * @throws Exception
	 */
	public List<User> getUsersByToken(String token) throws Exception{
		return userCheckMapper.getUsersByToken(token);
	}
	/**
	 * 获取白名单
	 * @param map
	 * @return
	 * @throws Exception
	 */
	public List<InterfaceWhite> getAllInterfaceWhite(Map<String,String> map) throws Exception{
		return userCheckMapper.getAllInterfaceWhite(map);
	}

	/**
	 * 用户是否存在于黑名单中
	 * @param userId
	 * @return
	 */
	public int isExistExceptionUser(Long userId) throws Exception {
		return userCheckMapper.isExistExceptionUser(userId);
	}
}
